package com.mt.system.service.impl;

import java.util.List;
import java.util.Map;

import org.springframework.stereotype.Service;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;

import com.mt.common.PagerInfo;
import com.mt.common.ServiceResult;
import com.mt.common.constants.BaseErrorConstants;
import com.mt.system.api.service.ICityService;
import com.mt.system.entity.CityEntity;
import com.mt.system.service.model.CityServiceModel;

@Service
public class CityServiceImpl implements ICityService {

    private static final org.slf4j.Logger LOGGER = LoggerFactory.getLogger(CityServiceImpl.class);

    @Autowired
    private CityServiceModel cityServiceModel;

    public ServiceResult<CityEntity> findInfo(Map<String, Object> params) {
        // 查询用户信息
        ServiceResult<CityEntity> result = null;
        try {
            result = cityServiceModel.selectInfo(params);
        } catch (Exception e) {
            LOGGER.error("[CityServiceImpl][findInfo]：query findInfo occur exception", e);
            result.setError(BaseErrorConstants.ERROR_CODE_SERVICE_CONTROLLER, "查询详情错误");
        }
        return result;
    }

    public ServiceResult<List<CityEntity>> findList(Map<String, Object> params, PagerInfo<?> pagerInfo) {
        ServiceResult<List<CityEntity>> result = new ServiceResult<List<CityEntity>>();
        try {
            result = cityServiceModel.selectList(params, pagerInfo);
        } catch (Exception e) {
            LOGGER.error("[CityServiceImpl][findList]：query findList occur exception", e);
            result.setError(BaseErrorConstants.ERROR_CODE_SERVICE_CONTROLLER, "查询列表错误");
        }

        return result;
    }

}
